import QtQuick 2.0
import QtGraphicalEffects 1.0   // 用于处理img 高亮显示
Rectangle{


    Item{
        height: 60
        anchors.top: parent.top
        anchors.right: parent.right
        anchors.left: parent.left

        Row{
            id: miniMaxRow
            anchors.verticalCenter: parent.verticalCenter // 垂直布局于父类 即上一层 Rectangle
            anchors.right: parent.right // 绑定于父类的右边
            anchors.rightMargin: 0.02*window.width // 预留的间隔
            spacing: 15 // 行布局的控件之间的间隔

            // 待定义
            Image {
                id: miniImg

                source: "qrc:/img/Resources/title/mini.png"
                anchors.verticalCenter: parent.verticalCenter // 垂直布局于父类 即上一层 Row
                layer.enabled: false
                layer.effect: ColorOverlay{
                    source:miniImg
                    color: "white"

                }

                MouseArea{
                    anchors.fill: parent
                    hoverEnabled: true
                    onEntered: {
                        parent.layer.enabled = true
                    }

                    onExited: {
                        parent.layer.enabled = false
                    }

                    onClicked: {

                    }
                }
            }

            // 最小化
            Rectangle{
                // 水平直线用于最小
                id:miniRect
                width: 20
                height: 2

                color: "#75777f"
                anchors.verticalCenter: parent.verticalCenter // 垂直布局于父类 即上一层 Row

                MouseArea{
                    anchors.fill: parent
                    hoverEnabled: true
                    onEntered: {
                        parent.color = "white"
                    }

                    onExited: {
                        parent.color = "#75777f"
                    }

                    onClicked: {
                        window.showMinimized()
                    }
                }
            }

            // 最大化
            Rectangle{
                // 正方形的图标用于最大
                width: 20
                height: width
                radius: 2
                border.width: 1
                border.color: "#75777f"
                color: "transparent" //窗体内容透明
                anchors.verticalCenter: parent.verticalCenter // 垂直布局于父类 即上一层 Row

                MouseArea{
                    anchors.fill: parent
                    hoverEnabled: true
                    onEntered: {
                        parent.border.color = "white"
                    }

                    onExited: {
                        parent.border.color = "#75777f"
                    }

                    onClicked: {
                        window.showMaximized()
                    }
                }
            }

            // 关闭
            Image {
                id: closeImg

                source: "qrc:/img/Resources/title/close.png"
                anchors.verticalCenter: parent.verticalCenter // 垂直布局于父类 即上一层 Row

                layer.enabled: false
                layer.effect: ColorOverlay{
                    source:closeImg
                    color: "white"

                }

                MouseArea{
                    anchors.fill: parent
                    hoverEnabled: true
                    onEntered: {
                        parent.layer.enabled = true
                    }

                    onExited: {
                        parent.layer.enabled = false
                    }

                    onClicked: {
                        Qt.quit()
                    }
                }
            }

        }
    }
}

